package WaiBao;

import java.util.Arrays;

public class JiaBingJi {
    public static void main(String[] args) {
        String[] name = {"张大大(班长)", "吴彦祖(副班长)", "小李(学习委员)", "古天乐(体育委员)", "张家辉", "梁家辉", "张学友", "梁朝伟", "张村发", "吴征宇", "吴郑宇", "曾志伟",
                "范彬彬", "谢冰冰", "谢斌斌", "肖秀荣", "吴奇隆", "徐涛", "李忠祥", "张家峰", "张晓伟", "赵德汉", "燕双鹰", "李大虎", "倪大红", "韩婧格", "吴镇宇", "古天乐",
                "黄磊", "贾冰吉(学生)"};//考生本人:贾冰吉(学生)
        int[] age = {18,19, 20, 21, 22,21, 18, 18, 19, 19, 18, 19, 18, 22, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 20, 19, 18, 19};//考生年龄：19


        double[] huli1 = {74, 78, 59, 84, 79, 68, 78, 89, 60, 80, 91, 87, 85, 78, 63, 68, 69, 99, 96, 88, 92, 91, 95, 85, 75, 74, 78, 86, 80, 96};
        double[] huli2 = {69, 81, 87, 84, 71, 80, 76, 83, 67, 70, 95, 67, 86, 75, 95, 65, 86, 79, 66, 78, 82, 71, 89, 86, 74, 85, 74, 73, 88, 96};
        double[] huli3 = {87, 83, 99, 74, 85, 75, 63, 69, 80, 69, 73, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 83, 73, 74, 88, 95};


        double monkey1;//代表每个学生的总分
        double monkey2;//代表每个学生的平均分
        for (int i = 0; i < 30; i++) {
            monkey1 =  huli1[i] +  huli2[i] + huli3[i];
            monkey2 = (monkey1 * 1.0) / 3;
            System.out.println(name[i] + "的总分为:" +monkey1);
            System.out.println(name[i] + "的平均分为:" + monkey2);
        }

        double kity1 = 0, kity2 = 0;
        double[] juhua = new double[30];
//        for (int i = 0; i < 30; i++) {
//            kity1 =huli1[i] + huli2[i] + huli3[i];
//            kity2 = (kity1 * 1.0) / 3;
//            juhua[i] = kity2;
//        }
//
//        for (int i = 0; i < juhua.length - 1; i++) {
//            for (int j = 0; j <juhua.length - i - 1; j++) {
//                if (juhua[j] < juhua[j + 1]) {
//                    double temp = juhua[j];
//                    juhua[j] =juhua[j + 1];
//                    juhua[j + 1] = temp;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(juhua[i]);
//        }



//        double genji1 = 0,genji2 = 0, genji3 = 0;//计算每门课的平均分
//        double tang1 = 0,tang2 = 0,tang3 = 0;//计算每门课标准差
//        double yaoshui1 = 0,yaoshui2 = 0, yaoshui3 = 0;//计算每门课中位数
//        double sap = 0;
//        for (int i = 0; i < huli1.length; i++) {
//            sap+=huli1[i];
//        }
//        genji1 = (sap*1.0)/30;
//        System.out.println("分析化学的班级平均分为:"+ genji1);
//        double Sum = 0;
//        for (int i = 0; i < huli2.length; i++) {
//            Sum+=huli2[i];
//        }
//        genji2 = (Sum*1.0)/30;
//        System.out.println("线性代数的班级平均分为:"+genji2);
//        double sum = 0;
//        for (int i = 0; i <huli3.length; i++) {
//            sum+=huli3[i];
//        }
//        genji3 = (sum*1.0)/30;
//        System.out.println("有机化学的班级平均分为:"+ genji3);
//
//
//
//
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i < huli1.length; i++) {
//            c1+= (huli1[i] - genji1)*(huli1[i] - genji1);
//        }
//        tang1 = Math.sqrt(c1*1.0/30);
//        System.out.println("分析化学的班级标准差为:"+ tang1);
//
//        for (int i = 0; i <huli2.length; i++) {
//            c2+= (huli2[i] - genji2)*(huli2[i] -genji2);
//        }
//        tang2 = Math.sqrt(c2*1.0/30);
//        System.out.println("线性代数的班级标准差为:"+ tang2);
//
//        for (int i = 0; i <huli3.length; i++) {
//            c3+= (huli3[i] - genji3)*(huli3[i] - genji3);
//        }
//        tang3 = Math.sqrt(c3*1.0/30);
//        System.out.println("有机化学的班级标准差为:"+tang3);
//////
////////
////////
//        Arrays.sort(huli1);
//        Arrays.sort(huli2);
//        Arrays.sort(huli3);
//        yaoshui1 =( huli1[14]+huli1[15])*1.0/2;
//        yaoshui2 =( huli2[14]+huli2[15])*1.0/2;
//        yaoshui3 =( huli3[14]+huli3[15])*1.0/2;
//        System.out.println("分析化学的中位数为:"+  yaoshui1);
//        System.out.println("线性代数的中位数为:"+  yaoshui2);
//        System.out.println("有机化学学的中位数为:"+  yaoshui3);



    }
}
